/* your js go here */
$(function () {

    $("#lookImg").click(function () {
       $("#picFile").click();
    });

    $("#picFile").change(function () {
        var f = document.getElementById("picFile").files[0];
        var data = new FormData();
        data.append("f1",f);

        $.ajax({
            type: "post",
            url: "/user/uploadImg",
            data: data,
            async:false,
            processData: false,
            contentType: false,
            success: function (res) {
                if(res != null){
                    $("#lookImg").attr("src",res);
                    $("#sideImg").attr("src",res)
                }
            },
            error: function (res) {

            }
        })
     });

    $("#avatar").click(function () {
        console.log("你点击了头像");
        window.location.href = "/user/look?uId=" + $(".uId").val();
    });

    //file表单选中文件时,让file表单的val展示到showname这个展示框
    $('#myFile').change(function () {
        $('#showname').val($(this).val())
    });

    //用户列表，查看详情，通过class名字userDetail来找
    $(".userDetail").click(function () {
        console.log("你点击了用户详情");
        var path = $('#xb').val();
        var uId = $(this).attr('data-id');
        var apiPath = 'user/look?uId=' + uId;
        var url='';
        if(path===''){
            url=apiPath;
        }else {
            url=path+apiPath;
        }
        window.location.href = url + '&flag=1';
    });

    //发布会议跳转链接
    $("#addMeet").click(function () {
        window.location.href = '../view/meetingAdd'
    });

    //添加文章跳转链接
    $("#addArt").click(function () {
        window.location.href = '../view/articleAdd'
    });


    $(".myList>ul>li").on("click",function () {
        if($(this).find("div").attr('class')=='list-group myGroup isHidden'){
            $(this).find("div").removeClass("isHidden")
        }else{
            $(this).find("div").addClass("isHidden")
        }


    });


});

